Ext.define('StaffServer.view.index.West', {
	extend : 'Ext.tree.Panel',
	 alias: 'widget.west',
	    title: '菜单',
	    collapsible: true,
	    animCollapse: true,
	    margins: '5 0 5 5',
	    layout: 'fit',
	    initComponent: function() {
	    	//需要优化
	    	var me = this, treeData;
	    	
	    	Ext.Ajax.request({
	    		url: 'data/menu.json',
	    		async:false,
	    		method: 'GET',
	    		headers:{'Accept':'application/json'},
	    		success: function(response, opts) {
	    			treeData= {
	    					children:Ext.JSON.decode(response.responseText).result
	    					};
	    	    }
	    	});
	    	//console.log(treeData);
	        var store= Ext.create('Ext.data.TreeStore', {
	        	clearOnLoad : true, 
	        	root:treeData,
	            autoLoad :true,
	            nodeParam:'id',
	            fields:[ 'id', {name:'text',mapping:'name'}, 'leaf','value' ]
	        });
	    	
	    	Ext.apply(this, {
	        	 store :store,
	        	 hideHeaders: true,
	             rootVisible: false
	             /*viewConfig: {
	                 plugins: [{
	                     ptype: 'treeviewdragdrop'
	                 }]
	             }*/
	             /*listeners: { 
	                 itemclick: Ext.bind(me.onItemclick, me) 
	             }*/
	    	})
	        this.callParent(arguments);
	    }
	});